import {apiResquest} from './api.js'

// 查询航班
export const selectByStartCityAndEndCity = (startCity,endCity,date) => {
  return apiResquest({
    url:'/ams/api/airline/selectByStartCityAndEndCity.open?startCity='+startCity+'&endCity='+endCity+'&date='+date,
    method:'get'
  })
}
// 查询中转航班
export const selectZhuanByStartCityAndEndCity = (startCity,endCity,date) => {
  return apiResquest({
    url:'/ams/api/airline/selectZhuanByStartCityAndEndCity.open?startCity='+startCity+'&endCity='+endCity+'&date='+date,
    method:'get'
  })
}

// 航班推荐喜欢
export const recommendAirlineLove = (airlineName,date) => {
  return apiResquest({
    url:'ams/api/recommend/recommendAirline.open?airlineName='+airlineName+'&date='+date,
    method:'get'
  })
}
// 航班推荐相似
export const recommendAirlineLike = (airlineName,date) => {
  return apiResquest({
    url:'ams/api/recommend/similarityAirline.open?airlineName='+airlineName+'&date='+date,
    method:'get'
  })
}

// 购票信息
export const buyTicket = (query) => {
  return apiResquest({
    url:'/ams/api/ticket/buyTicket.open',
    method:'post',
	query
  })
}
// 退票
export const backTicket = (query) => {
  return apiResquest({
    url:'/ams/api/ticket/backTicket.open',
    method:'post',
	query
  })
}
// 查询余票
export const countSurplusTicket = (airlineId) => {
  return apiResquest({
    url:'ams/api/ticket/countSurplusTicket.open?airlineId='+airlineId,
    method:'get'
  })
}
// 评分
export const insertRate = (query) => {
  return apiResquest({
    url:'ams/api/rating/insert.open',
    method:'post',
	query
  })
}

// 查询当前航线信息
export const airline = (airlineId) => {
  return apiResquest({
    url:'ams/api/airline/selectById.open?airlineId='+airlineId,
    method:'get'
  })
}

// 新闻查询(全部)
export const NewsSelectAll = () => {
  return apiResquest({
    url:'/ams/api/news/selectAll.open',
    method:'get'
  })
}
// 新闻查询(单个)
export const NewsSelectById = (id) => {
  return apiResquest({
    url:'/ams/api/news/selectById.open?newsId='+id,
    method:'get'
  })
}

// 用户登录
export const login = (query) => {
  return apiResquest({
    url:'/ams/api/user/login.open',
    method:'post',
	query
  })
}
// 用户注册
export const register = (query) => {
  return apiResquest({
    url:'ams/api/user/register.open',
    method:'post',
	query
  })
}
// vip
export const getVip = (id) => {
  return apiResquest({
    url:'ams/api/vip/selectByUserId.open?userId='+id,
    method:'get'
  })
}

// 用户是否登录
export const Islogin = () => {
  return apiResquest({
    url:'ams/api/user/isLogin.open',
    method:'get'
  })
}

// 是否买过机票
export const searchTicket = (idCard) => {
  return apiResquest({
    url:'ams/api/ticket/selectByIdCard.open?idCard='+idCard,
    method:'get'
  })
}

